package com.cskaoyan.bean;

import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor

public class PageData {
    Integer page;
    Integer limit;
    Integer pages;
    List list;
    Integer total;

    public static PageData list(List goodsList) {
        PageData data = new PageData();
        PageInfo pageInfo = new PageInfo(goodsList);
        data.setPage(pageInfo.getPageNum());
        data.setLimit(pageInfo.getPageSize());
        data.setPages(pageInfo.getPages());
        data.setTotal((int)pageInfo.getTotal());
        data.setList(pageInfo.getList());
        return data;
    }
}
